<!--
 * @Description: 侧边栏
-->
<template>
  <el-aside :style="{ width: !this.$store.state.isCollapse ? '200px' : '64px' }">
    <el-menu
      :router="true"
      :default-active="route.fullPath"
      :collapse="this.$store.state.isCollapse"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
    >
      <el-menu-item index="/index">
        <el-icon><HomeFilled /></el-icon>
        <span>首页</span>
      </el-menu-item>
      <el-menu-item index="/center">
        <el-icon><avatar /></el-icon>
        <span>个人中心</span>
      </el-menu-item>

      <el-sub-menu index="/user-manage">
        <template #title>
          <el-icon><UserFilled /></el-icon>
          <span>用户管理</span>
        </template>
        <el-menu-item index="/user-manage/add-user">添加用户</el-menu-item>
        <el-menu-item index="/user-manage/user-list">用户列表</el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="/news-manage">
        <template #title>
          <el-icon><MessageBox /></el-icon>
          <span>新闻管理</span>
        </template>
        <el-menu-item index="/news-manage/add-news">添加新闻</el-menu-item>
        <el-menu-item index="/news-manage/news-list">新闻列表</el-menu-item>
      </el-sub-menu>
      <el-sub-menu index="/news-manage">
        <template #title>
          <el-icon><Reading /></el-icon>
          <span>产品管理</span>
        </template>
        <el-menu-item index="/product-manage/add-product"
          >添加产品</el-menu-item
        >
        <el-menu-item index="/product-manage/product-list"
          >产品列表</el-menu-item
        >
      </el-sub-menu>
    </el-menu>
  </el-aside>
</template>

<script setup>
import { useRoute } from 'vue-router';
import {
  MessageBox,
  HomeFilled,
  UserFilled,
  Reading,Avatar
} from '@element-plus/icons-vue';

const route = useRoute();
const handleOpen = (key, keyPath) => {
  // console.log(key, keyPath);
};
const handleClose = (key, keyPath) => {
  // console.log(key, keyPath);
};
</script>
<script>

</script>

<style lang="scss" scoped>
.el-aside {
  height: 100vh;
  .el-menu {
    height: 100vh;
  }
}
</style>
